namespace Maple.Branch.Features.DomainTests
{
    using System;
    using EfCoreConfigurations;
    using TestBases;

    public abstract class FeaturesDomainTestBase : FeaturesTestBase<FeaturesDomainTestModule>
    {
        protected virtual void UsingDbContext(Action<IFeaturesDbContext> action)
        {
            using var dbContext = GetRequiredService<IFeaturesDbContext>();

            action.Invoke(dbContext);
        }

        protected virtual T UsingDbContext<T>(Func<IFeaturesDbContext, T> action)
        {
            using var dbContext = GetRequiredService<IFeaturesDbContext>();

            return action.Invoke(dbContext);
        }
    }
}
